package binarysearch.test441;

/**
 * 排列硬币
 *
 * @author code_yc
 * @version 1.0
 * @date 2020/7/13 11:48
 */
public class Solution1 {

    // 循环 ： 超时
    public int arrangeCoins(int n) {
        if (n == 0) return 0;
        int sum = 1;
        int c = 1;
        while (sum <= n) {
            c++;
            sum += c;
        }
        return c - 1;
    }
}
